from django.contrib import admin
from apps.works.models import MobileStationInfoModel, TouristTypeInfoModel, TouristRideInfoModel


# Register your models here.


class MobileStationInfoAdmin(admin.ModelAdmin):
    """
    移动站点信息管理类
    """
    list_display = ['id', 'car', 'name']
    ordering = ('id',)
    fields = ['id', 'car', 'name']
    list_filter = ['id', 'car', 'name']
    # 外键不能成为搜索字段
    search_fields = ['id', 'car', 'name']
    list_per_page = 20
    # 操作记录时，显示选择多少个数
    actions_selection_counter = True


class TouristTypeInfoAdmin(admin.ModelAdmin):
    """
    车旅客类型信息管理类
    """
    list_display = ['id', 'name']
    ordering = ('id',)
    fields = ['id', 'name']
    list_filter = ['id', 'name']
    # 外键不能成为搜索字段
    search_fields = ['id', 'name']
    list_per_page = 20
    # 操作记录时，显示选择多少个数
    actions_selection_counter = True


class TouristRideInfoAdmin(admin.ModelAdmin):
    """
    旅客乘车信息管理类
    """
    list_display = ['id', 'car', 'tourist_type', 'from_station', 'to_station', 'carfare', 'notes', 'creator',
                    'is_arrive', 'created_time']
    ordering = ('id',)
    fields = ['id', 'car', 'tourist_type', 'from_station', 'to_station', 'carfare', 'notes', 'creator', 'is_arrive',
              'created_time']
    list_filter = ['id', 'car', 'tourist_type', 'from_station', 'to_station', 'carfare', 'notes', 'creator',
                   'is_arrive', 'created_time']
    # 外键不能成为搜索字段
    search_fields = ['id', 'car', 'tourist_type', 'from_station', 'to_station', 'carfare', 'notes', 'creator',
                     'is_arrive', 'created_time']
    list_per_page = 20
    # 操作记录时，显示选择多少个数
    actions_selection_counter = True


admin.site.register(MobileStationInfoModel, MobileStationInfoAdmin)
admin.site.register(TouristTypeInfoModel, TouristTypeInfoAdmin)
admin.site.register(TouristRideInfoModel, TouristRideInfoAdmin)
